﻿using System;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using HslCommunication.BasicFramework;
using HslCommunication.Core;
using HslCommunication.Core.IMessage;
using HslCommunication.Core.Net;
using HslCommunication.Reflection;

namespace HslCommunication.Profinet.Melsec
{
	/// <summary>
	/// 三菱PLC通讯协议，采用A兼容1E帧协议实现，使用ASCII码通讯，请根据实际型号来进行选取<br />
	/// Mitsubishi PLC communication protocol, implemented using A compatible 1E frame protocol, using ascii code communication, please choose according to the actual model
	/// </summary>
	/// <remarks>
	/// <inheritdoc cref="T:HslCommunication.Profinet.Melsec.MelsecA1ENet" path="remarks" />
	/// </remarks>
	// Token: 0x02000063 RID: 99
	public class MelsecA1EAsciiNet : NetworkDeviceBase
	{
		/// <summary>
		/// 实例化一个默认的对象<br />
		/// Instantiate a default object
		/// </summary>
		// Token: 0x0600081D RID: 2077 RVA: 0x0002BAC5 File Offset: 0x00029CC5
		public MelsecA1EAsciiNet()
		{
			base.WordLength = 1;
			this.LogMsgFormatBinary = false;
			base.ByteTransform = new RegularByteTransform();
		}

		/// <summary>
		/// 指定ip地址和端口来来实例化一个默认的对象<br />
		/// Specify the IP address and port to instantiate a default object
		/// </summary>
		/// <param name="ipAddress">PLC的Ip地址</param>
		/// <param name="port">PLC的端口</param>
		// Token: 0x0600081E RID: 2078 RVA: 0x0002BAF5 File Offset: 0x00029CF5
		public MelsecA1EAsciiNet(string ipAddress, int port)
		{
			base.WordLength = 1;
			this.IpAddress = ipAddress;
			this.Port = port;
			this.LogMsgFormatBinary = false;
			base.ByteTransform = new RegularByteTransform();
		}

		/// <inheritdoc />
		// Token: 0x0600081F RID: 2079 RVA: 0x0002BB35 File Offset: 0x00029D35
		protected override INetMessage GetNewNetMessage()
		{
			return new MelsecA1EAsciiMessage();
		}

		/// <inheritdoc cref="P:HslCommunication.Profinet.Melsec.MelsecA1ENet.PLCNumber" />
		// Token: 0x17000178 RID: 376
		// (get) Token: 0x06000820 RID: 2080 RVA: 0x0002BB3C File Offset: 0x00029D3C
		// (set) Token: 0x06000821 RID: 2081 RVA: 0x0002BB44 File Offset: 0x00029D44
		public byte PLCNumber { get; set; } = byte.MaxValue;

		/// <inheritdoc cref="M:HslCommunication.Profinet.Melsec.MelsecA1ENet.Read(System.String,System.UInt16)" />
		// Token: 0x06000822 RID: 2082 RVA: 0x0002BB50 File Offset: 0x00029D50
		[HslMqttApi("ReadByteArray", "")]
		public override OperateResult<byte[]> Read(string address, ushort length)
		{
			OperateResult<byte[]> operateResult = MelsecA1EAsciiNet.BuildReadCommand(address, length, false, this.PLCNumber);
			bool flag = !operateResult.IsSuccess;
			OperateResult<byte[]> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<byte[]>(operateResult);
			}
			else
			{
				OperateResult<byte[]> operateResult2 = base.ReadFromCoreServer(operateResult.Content);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<byte[]>(operateResult2);
				}
				else
				{
					OperateResult operateResult3 = MelsecA1EAsciiNet.CheckResponseLegal(operateResult2.Content);
					bool flag3 = !operateResult3.IsSuccess;
					if (flag3)
					{
						result = OperateResult.CreateFailedResult<byte[]>(operateResult3);
					}
					else
					{
						result = MelsecA1EAsciiNet.ExtractActualData(operateResult2.Content, false);
					}
				}
			}
			return result;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Melsec.MelsecA1ENet.Write(System.String,System.Byte[])" />
		// Token: 0x06000823 RID: 2083 RVA: 0x0002BBE4 File Offset: 0x00029DE4
		[HslMqttApi("WriteByteArray", "")]
		public override OperateResult Write(string address, byte[] value)
		{
			OperateResult<byte[]> operateResult = MelsecA1EAsciiNet.BuildWriteWordCommand(address, value, this.PLCNumber);
			bool flag = !operateResult.IsSuccess;
			OperateResult result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				OperateResult<byte[]> operateResult2 = base.ReadFromCoreServer(operateResult.Content);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = operateResult2;
				}
				else
				{
					OperateResult operateResult3 = MelsecA1EAsciiNet.CheckResponseLegal(operateResult2.Content);
					bool flag3 = !operateResult3.IsSuccess;
					if (flag3)
					{
						result = OperateResult.CreateFailedResult<byte[]>(operateResult3);
					}
					else
					{
						result = OperateResult.CreateSuccessResult();
					}
				}
			}
			return result;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Melsec.MelsecA1EAsciiNet.Read(System.String,System.UInt16)" />
		// Token: 0x06000824 RID: 2084 RVA: 0x0002BC64 File Offset: 0x00029E64
		[DebuggerStepThrough]
		public override Task<OperateResult<byte[]>> ReadAsync(string address, ushort length)
		{
			MelsecA1EAsciiNet.<ReadAsync>d__9 <ReadAsync>d__ = new MelsecA1EAsciiNet.<ReadAsync>d__9();
			<ReadAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<byte[]>>.Create();
			<ReadAsync>d__.<>4__this = this;
			<ReadAsync>d__.address = address;
			<ReadAsync>d__.length = length;
			<ReadAsync>d__.<>1__state = -1;
			<ReadAsync>d__.<>t__builder.Start<MelsecA1EAsciiNet.<ReadAsync>d__9>(ref <ReadAsync>d__);
			return <ReadAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Melsec.MelsecA1EAsciiNet.Write(System.String,System.Byte[])" />
		// Token: 0x06000825 RID: 2085 RVA: 0x0002BCB8 File Offset: 0x00029EB8
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, byte[] value)
		{
			MelsecA1EAsciiNet.<WriteAsync>d__10 <WriteAsync>d__ = new MelsecA1EAsciiNet.<WriteAsync>d__10();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.value = value;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<MelsecA1EAsciiNet.<WriteAsync>d__10>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Melsec.MelsecA1ENet.ReadBool(System.String,System.UInt16)" />
		// Token: 0x06000826 RID: 2086 RVA: 0x0002BD0C File Offset: 0x00029F0C
		[HslMqttApi("ReadBoolArray", "")]
		public override OperateResult<bool[]> ReadBool(string address, ushort length)
		{
			OperateResult<byte[]> operateResult = MelsecA1EAsciiNet.BuildReadCommand(address, length, true, this.PLCNumber);
			bool flag = !operateResult.IsSuccess;
			OperateResult<bool[]> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<bool[]>(operateResult);
			}
			else
			{
				OperateResult<byte[]> operateResult2 = base.ReadFromCoreServer(operateResult.Content);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<bool[]>(operateResult2);
				}
				else
				{
					OperateResult operateResult3 = MelsecA1EAsciiNet.CheckResponseLegal(operateResult2.Content);
					bool flag3 = !operateResult3.IsSuccess;
					if (flag3)
					{
						result = OperateResult.CreateFailedResult<bool[]>(operateResult3);
					}
					else
					{
						OperateResult<byte[]> operateResult4 = MelsecA1EAsciiNet.ExtractActualData(operateResult2.Content, true);
						bool flag4 = !operateResult4.IsSuccess;
						if (flag4)
						{
							result = OperateResult.CreateFailedResult<bool[]>(operateResult4);
						}
						else
						{
							result = OperateResult.CreateSuccessResult<bool[]>(Enumerable.ToArray<bool>(Enumerable.Take<bool>(Enumerable.Select<byte, bool>(operateResult4.Content, (byte m) => m == 1), (int)length)));
						}
					}
				}
			}
			return result;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Melsec.MelsecA1ENet.Write(System.String,System.Boolean[])" />
		// Token: 0x06000827 RID: 2087 RVA: 0x0002BDFC File Offset: 0x00029FFC
		[HslMqttApi("WriteBoolArray", "")]
		public override OperateResult Write(string address, bool[] values)
		{
			OperateResult<byte[]> operateResult = MelsecA1EAsciiNet.BuildWriteBoolCommand(address, values, this.PLCNumber);
			bool flag = !operateResult.IsSuccess;
			OperateResult result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				OperateResult<byte[]> operateResult2 = base.ReadFromCoreServer(operateResult.Content);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = operateResult2;
				}
				else
				{
					result = MelsecA1EAsciiNet.CheckResponseLegal(operateResult2.Content);
				}
			}
			return result;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Melsec.MelsecA1EAsciiNet.ReadBool(System.String,System.UInt16)" />
		// Token: 0x06000828 RID: 2088 RVA: 0x0002BE58 File Offset: 0x0002A058
		[DebuggerStepThrough]
		public override Task<OperateResult<bool[]>> ReadBoolAsync(string address, ushort length)
		{
			MelsecA1EAsciiNet.<ReadBoolAsync>d__13 <ReadBoolAsync>d__ = new MelsecA1EAsciiNet.<ReadBoolAsync>d__13();
			<ReadBoolAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<bool[]>>.Create();
			<ReadBoolAsync>d__.<>4__this = this;
			<ReadBoolAsync>d__.address = address;
			<ReadBoolAsync>d__.length = length;
			<ReadBoolAsync>d__.<>1__state = -1;
			<ReadBoolAsync>d__.<>t__builder.Start<MelsecA1EAsciiNet.<ReadBoolAsync>d__13>(ref <ReadBoolAsync>d__);
			return <ReadBoolAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Melsec.MelsecA1EAsciiNet.Write(System.String,System.Boolean[])" />
		// Token: 0x06000829 RID: 2089 RVA: 0x0002BEAC File Offset: 0x0002A0AC
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, bool[] values)
		{
			MelsecA1EAsciiNet.<WriteAsync>d__14 <WriteAsync>d__ = new MelsecA1EAsciiNet.<WriteAsync>d__14();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.values = values;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<MelsecA1EAsciiNet.<WriteAsync>d__14>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x0600082A RID: 2090 RVA: 0x0002BEFE File Offset: 0x0002A0FE
		public override string ToString()
		{
			return string.Format("MelsecA1ENet[{0}:{1}]", this.IpAddress, this.Port);
		}

		/// <summary>
		/// 根据类型地址长度确认需要读取的指令头
		/// </summary>
		/// <param name="address">起始地址</param>
		/// <param name="length">长度</param>
		/// <param name="isBit">指示是否按照位成批的读出</param>
		/// <param name="plcNumber">PLC编号</param>
		/// <returns>带有成功标志的指令数据</returns>
		// Token: 0x0600082B RID: 2091 RVA: 0x0002BF1C File Offset: 0x0002A11C
		public static OperateResult<byte[]> BuildReadCommand(string address, ushort length, bool isBit, byte plcNumber)
		{
			OperateResult<MelsecA1EDataType, int> operateResult = MelsecHelper.McA1EAnalysisAddress(address);
			bool flag = !operateResult.IsSuccess;
			OperateResult<byte[]> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<byte[]>(operateResult);
			}
			else
			{
				byte value = isBit ? 0 : 1;
				result = OperateResult.CreateSuccessResult<byte[]>(new byte[]
				{
					SoftBasic.BuildAsciiBytesFrom(value)[0],
					SoftBasic.BuildAsciiBytesFrom(value)[1],
					SoftBasic.BuildAsciiBytesFrom(plcNumber)[0],
					SoftBasic.BuildAsciiBytesFrom(plcNumber)[1],
					48,
					48,
					48,
					65,
					SoftBasic.BuildAsciiBytesFrom(operateResult.Content1.DataCode[0])[0],
					SoftBasic.BuildAsciiBytesFrom(operateResult.Content1.DataCode[0])[1],
					SoftBasic.BuildAsciiBytesFrom(operateResult.Content1.DataCode[1])[0],
					SoftBasic.BuildAsciiBytesFrom(operateResult.Content1.DataCode[1])[1],
					SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[3])[0],
					SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[3])[1],
					SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[2])[0],
					SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[2])[1],
					SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[1])[0],
					SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[1])[1],
					SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[0])[0],
					SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[0])[1],
					SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes((int)(length % 256))[0])[0],
					SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes((int)(length % 256))[0])[1],
					48,
					48
				});
			}
			return result;
		}

		/// <summary>
		/// 根据类型地址以及需要写入的数据来生成指令头
		/// </summary>
		/// <param name="address">起始地址</param>
		/// <param name="value">数据值</param>
		/// <param name="plcNumber">PLC编号</param>
		/// <returns>带有成功标志的指令数据</returns>
		// Token: 0x0600082C RID: 2092 RVA: 0x0002C104 File Offset: 0x0002A304
		public static OperateResult<byte[]> BuildWriteWordCommand(string address, byte[] value, byte plcNumber)
		{
			OperateResult<MelsecA1EDataType, int> operateResult = MelsecHelper.McA1EAnalysisAddress(address);
			bool flag = !operateResult.IsSuccess;
			OperateResult<byte[]> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<byte[]>(operateResult);
			}
			else
			{
				value = MelsecHelper.TransByteArrayToAsciiByteArray(value);
				byte[] array = new byte[24 + value.Length];
				array[0] = 48;
				array[1] = 51;
				array[2] = SoftBasic.BuildAsciiBytesFrom(plcNumber)[0];
				array[3] = SoftBasic.BuildAsciiBytesFrom(plcNumber)[1];
				array[4] = 48;
				array[5] = 48;
				array[6] = 48;
				array[7] = 65;
				array[8] = SoftBasic.BuildAsciiBytesFrom(operateResult.Content1.DataCode[0])[0];
				array[9] = SoftBasic.BuildAsciiBytesFrom(operateResult.Content1.DataCode[0])[1];
				array[10] = SoftBasic.BuildAsciiBytesFrom(operateResult.Content1.DataCode[1])[0];
				array[11] = SoftBasic.BuildAsciiBytesFrom(operateResult.Content1.DataCode[1])[1];
				array[12] = SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[3])[0];
				array[13] = SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[3])[1];
				array[14] = SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[2])[0];
				array[15] = SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[2])[1];
				array[16] = SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[1])[0];
				array[17] = SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[1])[1];
				array[18] = SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[0])[0];
				array[19] = SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[0])[1];
				array[20] = SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(value.Length / 4)[0])[0];
				array[21] = SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(value.Length / 4)[0])[1];
				array[22] = 48;
				array[23] = 48;
				value.CopyTo(array, 24);
				result = OperateResult.CreateSuccessResult<byte[]>(array);
			}
			return result;
		}

		/// <summary>
		/// 根据类型地址以及需要写入的数据来生成指令头
		/// </summary>
		/// <param name="address">起始地址</param>
		/// <param name="value">数据值</param>
		/// <param name="plcNumber">PLC编号</param>
		/// <returns>带有成功标志的指令数据</returns>
		// Token: 0x0600082D RID: 2093 RVA: 0x0002C2E8 File Offset: 0x0002A4E8
		public static OperateResult<byte[]> BuildWriteBoolCommand(string address, bool[] value, byte plcNumber)
		{
			OperateResult<MelsecA1EDataType, int> operateResult = MelsecHelper.McA1EAnalysisAddress(address);
			bool flag = !operateResult.IsSuccess;
			OperateResult<byte[]> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<byte[]>(operateResult);
			}
			else
			{
				byte[] array = Enumerable.ToArray<byte>(Enumerable.Select<bool, byte>(value, (bool m) => m ? 49 : 48));
				bool flag2 = array.Length % 2 == 1;
				if (flag2)
				{
					array = SoftBasic.SpliceArray<byte>(new byte[][]
					{
						array,
						new byte[]
						{
							48
						}
					});
				}
				byte[] array2 = new byte[24 + array.Length];
				array2[0] = 48;
				array2[1] = 50;
				array2[2] = SoftBasic.BuildAsciiBytesFrom(plcNumber)[0];
				array2[3] = SoftBasic.BuildAsciiBytesFrom(plcNumber)[1];
				array2[4] = 48;
				array2[5] = 48;
				array2[6] = 48;
				array2[7] = 65;
				array2[8] = SoftBasic.BuildAsciiBytesFrom(operateResult.Content1.DataCode[0])[0];
				array2[9] = SoftBasic.BuildAsciiBytesFrom(operateResult.Content1.DataCode[0])[1];
				array2[10] = SoftBasic.BuildAsciiBytesFrom(operateResult.Content1.DataCode[1])[0];
				array2[11] = SoftBasic.BuildAsciiBytesFrom(operateResult.Content1.DataCode[1])[1];
				array2[12] = SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[3])[0];
				array2[13] = SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[3])[1];
				array2[14] = SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[2])[0];
				array2[15] = SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[2])[1];
				array2[16] = SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[1])[0];
				array2[17] = SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[1])[1];
				array2[18] = SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[0])[0];
				array2[19] = SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(operateResult.Content2)[0])[1];
				array2[20] = SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(value.Length)[0])[0];
				array2[21] = SoftBasic.BuildAsciiBytesFrom(BitConverter.GetBytes(value.Length)[0])[1];
				array2[22] = 48;
				array2[23] = 48;
				array.CopyTo(array2, 24);
				result = OperateResult.CreateSuccessResult<byte[]>(array2);
			}
			return result;
		}

		/// <summary>
		/// 检测反馈的消息是否合法
		/// </summary>
		/// <param name="response">接收的报文</param>
		/// <returns>是否成功</returns>
		// Token: 0x0600082E RID: 2094 RVA: 0x0002C51C File Offset: 0x0002A71C
		public static OperateResult CheckResponseLegal(byte[] response)
		{
			bool flag = response.Length < 4;
			OperateResult result;
			if (flag)
			{
				result = new OperateResult(StringResources.Language.ReceiveDataLengthTooShort);
			}
			else
			{
				bool flag2 = response[2] == 48 && response[3] == 48;
				if (flag2)
				{
					result = OperateResult.CreateSuccessResult();
				}
				else
				{
					bool flag3 = response[2] == 53 && response[3] == 66;
					if (flag3)
					{
						result = new OperateResult(Convert.ToInt32(Encoding.ASCII.GetString(response, 4, 2), 16), StringResources.Language.MelsecPleaseReferToManualDocument);
					}
					else
					{
						result = new OperateResult(Convert.ToInt32(Encoding.ASCII.GetString(response, 2, 2), 16), StringResources.Language.MelsecPleaseReferToManualDocument);
					}
				}
			}
			return result;
		}

		/// <summary>
		/// 从PLC反馈的数据中提取出实际的数据内容，需要传入反馈数据，是否位读取
		/// </summary>
		/// <param name="response">反馈的数据内容</param>
		/// <param name="isBit">是否位读取</param>
		/// <returns>解析后的结果对象</returns>
		// Token: 0x0600082F RID: 2095 RVA: 0x0002C5C8 File Offset: 0x0002A7C8
		public static OperateResult<byte[]> ExtractActualData(byte[] response, bool isBit)
		{
			OperateResult<byte[]> result;
			if (isBit)
			{
				result = OperateResult.CreateSuccessResult<byte[]>(Enumerable.ToArray<byte>(Enumerable.Select<byte, byte>(response.RemoveBegin(4), (byte m) => (m == 48) ? 0 : 1)));
			}
			else
			{
				result = OperateResult.CreateSuccessResult<byte[]>(MelsecHelper.TransAsciiByteArrayToByteArray(response.RemoveBegin(4)));
			}
			return result;
		}
	}
}
